function setCookie(name, value, timeout) {  
var d = new Date();  
d.setDate(d.getDate() + timeout);  
document.cookie = name + '=' + value + ';expires=' + d;  
}  
function getCookie(name) {  
var arr = document.cookie.split('; ');  
for ( var i = 0; i < arr.length; i++) {  
var arr2 = arr[i].split('='); //['abc','cba']  
if (arr2[0] == name) {  
return arr2[1];  
console.log(arr2[1]);  
}  
}  
return '';  
  
}  




//获取cookie  
var userName = getCookie("username");  
console.log(userName);  
if (userName) {  
$scope.user.username = userName;  
}  



if ($scope.checkbox) {  
//设置一天后清除cookie  
setCookie("username", $scope.user.username, 1);  
//跳转到一个登录成功页面  
$location.path("/member/personalInfo");  
} else {  
//跳转到一个登录成功页面  
$location.path("/member/personalInfo");  
}  